#include "votesys.h"

int 
main(int argc, char* argv[])
{
  CLIENT *cl;
  struct timeval tv;


  cl = clnt_create("localhost", VOTESYS, VOTEVERS, "visible");


  if( cl == NULL )
  {
    clnt_pcreateerror("Sever");
    return -1;
  }

  /*destory previous auth*/
  auth_destroy(cl->cl_auth);

  cl->cl_auth = authsys_create_default();

  //set timeout
  tv.tv_sec = 1;
  tv.tv_usec = 0;
  clnt_control(cl, CLSET_TIMEOUT, &tv);

  if( closevote_1(NULL, NULL, cl) != RPC_SUCCESS )
  {
     //clnt_perror(cl, "Server");
     fprintf(stderr, "CloseVoting unsuccessfully!\n");
     return -1;
  }

  printf("Voting is close!\n");

  return 0;
}
